/****** Object:  Stored Procedure [dbo].spChiTietBienBanNhapHangGet Script Date: 7/16/2012 ******/
IF EXISTS (SELECT * FROM dbo.sysobjects WHERE id = object_id(N'[dbo].[spChiTietBienBanNhapHangGet]') AND OBJECTPROPERTY(id, N'IsProcedure') = 1)
	DROP PROCEDURE [dbo].[spChiTietBienBanNhapHangGet]
GO

/******************************************************************************
**		Change History
*******************************************************************************
**		Date:		Author:					Description:
**		--------	--------				-----------------------------------
**		17/07/2012	SongTM					Innit created
*******************************************************************************/

CREATE PROCEDURE [dbo].[spChiTietBienBanNhapHangGet]
(
	@MaBBNH nvarchar(12),
	@MaCTPN nvarchar(12)
)
WITH ENCRYPTION
AS

SET NOCOUNT ON

SELECT 
	[tbl_ChiTietBienBanNhapHang].*,
	tbl_LuuKho.MaThuoc,
	tbl_LuuKho.SoLo
FROM 
	[tbl_ChiTietBienBanNhapHang] INNER JOIN tbl_ChiTietPhieuNhap on tbl_ChiTietPhieuNhap.MaCTPN = tbl_ChiTietBienBanNhapHang.MaCTPN
	INNER JOIN tbl_LuuKho ON tbl_LuuKho.MaLuuKho = tbl_ChiTietPhieuNhap.MaLuuKho
WHERE
	[MaBBNH] = @MaBBNH

	AND [tbl_ChiTietBienBanNhapHang].[MaCTPN] = @MaCTPN
GO

--GRANT EXECUTE ON [dbo].[spChiTietBienBanNhapHangGet] TO [sa]
--GO
